package com.xqb.modules.domain.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;

/**
 * 问题和业务关联表，例如把小节id和问题id关联，一个小节下可以有多个问题
 *
 * @author 赵鹏宇
 * @TableName exa_question_biz
 */
@TableName(value = "exa_question_biz")
@Data
public class ExaQuestionBiz implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 业务id，要关联问题的某业务id，例如小节id
     */
    private Long bizId;
    /**
     * 问题id
     */
    private Long questionId;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ExaQuestionBiz other = (ExaQuestionBiz) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getBizId() == null ? other.getBizId() == null : this.getBizId().equals(other.getBizId()))
                && (this.getQuestionId() == null ? other.getQuestionId() == null : this.getQuestionId().equals(other.getQuestionId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getBizId() == null) ? 0 : getBizId().hashCode());
        result = prime * result + ((getQuestionId() == null) ? 0 : getQuestionId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        String sb = getClass().getSimpleName() +
                " [" +
                "Hash = " + hashCode() +
                ", id=" + id +
                ", bizId=" + bizId +
                ", questionId=" + questionId +
                ", serialVersionUID=" + serialVersionUID +
                "]";
        return sb;
    }
}